package za.org.jcicada.deviceproxy.impl;

import za.org.jcicada.genss.sensor.SensorStatus;

/**
 * Enumeration for legal states for watchdog sensor
 */
public enum WatchdogEnum {
    NOMINAL(SensorStatus.NOMINAL), TIMEOUT(SensorStatus.ERROR);

    private final SensorStatus status;

    WatchdogEnum(SensorStatus status) {
        this.status = status;
    }

    public SensorStatus getStatus() {
        return status;
    }

    /**
     * Convert the enum to an array of strings
     * 
     * @return array of enum value names.
     */
    public static String[] stringArray() {
        // TODO Should actually figure out how to write a TypeDiscrete
        // constructor which takes an enum and does this for you!
        String[] array = new String[WatchdogEnum.values().length];
        for (WatchdogEnum state : WatchdogEnum.values()) {
            array[state.ordinal()] = state.toString();
        }
        return array;
    }
}